#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "Classifier.h"
#include "DeployedArtifact.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Manifestation;
class Operation;
class Property;

/// <summary>
/// Artifact
/// An artifact is the specification of a physical piece of information that is used
/// or produced by a software development process, or by deployment and operation of
/// a system. Examples of artifacts include model files, source files, scripts, and
/// binary executable files, a table in a database system, a development
/// deliverable, or a word-processing document, a mail message.
/// An artifact is
/// the source of a deployment to a node.
/// </summary>
class UMLMODEL_EXPORT Artifact : public Classifier, public DeployedArtifact {

public: // Constructors and destructors
    explicit Artifact(const QString& umlType="uml::Artifact");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// fileName getter
    /// A concrete name that is used to refer to the Artifact in a physical context.
    /// Example: file system name, universal resource locator.
    /// </summary>
    QString fileName() const;

    /// <summary>
    /// fileName setter
    /// A concrete name that is used to refer to the Artifact in a physical context.
    /// Example: file system name, universal resource locator.
    /// </summary>
    void setFileName(const QString& value);

    /// <summary>
    /// manifestations getter
    /// The set of model elements that are manifested in the Artifact. That is, these
    /// model elements are utilized in the construction (or generation) of the artifact.
    /// </summary>
    vector<shared_ptr<Manifestation>>& manifestations();

    /// <summary>
    /// nestedArtifacts getter
    /// The Artifacts that are defined (nested) within the Artifact. The association is
    /// a specialization of the ownedMember association from Namespace to NamedElement.
    /// </summary>
    vector<shared_ptr<Artifact>>& nestedArtifacts();

    /// <summary>
    /// ownedAttributes getter
    /// The attributes or association ends defined for the Artifact. The association is
    /// a specialization of the ownedMember association.
    /// </summary>
    vector<shared_ptr<Property>>& ownedAttributes();

    /// <summary>
    /// ownedOperations getter
    /// The Operations defined for the Artifact. The association is a specialization of
    /// the ownedMember association.
    /// </summary>
    vector<shared_ptr<Operation>>& ownedOperations();

private: // Fields
    /// <summary>
    /// fileName
    /// A concrete name that is used to refer to the Artifact in a physical context.
    /// Example: file system name, universal resource locator.
    /// </summary>
    const static QString fileName_default_;
    QString fileName_= fileName_default_;

    /// <summary>
    /// manifestations
    /// The set of model elements that are manifested in the Artifact. That is, these
    /// model elements are utilized in the construction (or generation) of the artifact.
    /// </summary>
    vector<shared_ptr<Manifestation>> manifestations_;

    /// <summary>
    /// nestedArtifacts
    /// The Artifacts that are defined (nested) within the Artifact. The association is
    /// a specialization of the ownedMember association from Namespace to NamedElement.
    /// </summary>
    vector<shared_ptr<Artifact>> nestedArtifacts_;

    /// <summary>
    /// ownedAttributes
    /// The attributes or association ends defined for the Artifact. The association is
    /// a specialization of the ownedMember association.
    /// </summary>
    vector<shared_ptr<Property>> ownedAttributes_;

    /// <summary>
    /// ownedOperations
    /// The Operations defined for the Artifact. The association is a specialization of
    /// the ownedMember association.
    /// </summary>
    vector<shared_ptr<Operation>> ownedOperations_;

};

} // namespace uml
